<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	DestinForm form = (DestinForm)request.getAttribute("command");
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String userName = user.getName();
	String siteId = user.getSiteId();	
%>

<div>
	<form id="DestinAddForm" target="_coreIframe" method="post" action="<%=request.getContextPath()%>/destin/doAdd" enctype="multipart/form-data">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>添加地址</li>
			</ul>
		</div>
		<table class="formTable">
			<tr>
				<td class="tdTitle">省份：</td>
				<td>
					<select id="prov" class="easyui-combobox" name="prov" style="width:200px;">
					</select>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">地级市：</td>
				<td>
					<select id="city" class="easyui-combobox" name="city" style="width:200px;">
					</select>							
				</td>
			</tr>
			<tr>
				<td class="tdTitle">县/市辖区：</td>
				<td>
					<select id="area" class="easyui-combobox" name="area" style="width:200px;">
					</select>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">详细地址：</td>
				<td>
					<input class="inputText l" type="text" placeholder="**乡**镇**街，不用重复输入省市县(区)" value="" name="address">
					<span class="errorTipWrap" id="errorTip_address"></span>
				</td>
			</tr>				
			<tr>
				<td class="tdTitle">目的地：</td>
				<td>
					<input class="inputText xs" type="text" placeholder="必填项" value="" name="areaname">
					<span class="errorTipWrap" id="errorTip_areaname"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">备注：</td>
				<td>
					<input class="inputText l" type="text" placeholder="可以不填" value="" name="memotext">
					<span class="errorTipWrap" id="errorTip_memotext"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle" style="color: red">提示：</td>
				<td><span>县/市辖区若选项没有可以选择空白选项，把县/市辖区填入详细地址前面</span></td>				
			</tr>				
			<input type="hidden" name="siteid" value="<%=siteId%>">
			<input type="hidden" name="userid" value="<%=userName%>">
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="javascript:XF.Destin.listDestin('<%=siteId%>')">取消</a>
					</div>
				</td>
			</tr>	
		</table>
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>




<script type="text/javascript">
$('#prov').combobox({
	url:global.contextPath + '/destin/getProv',
	valueField:'id',
	textField:'val',
	editable:false,
	panelHeight:300,
	onSelect:function(record){
		$('#city').combobox('clear'); //清除原来的数据  
		$('#area').combobox('clear');
        var url = global.contextPath + '/destin/getCity?prov=' + record.id; 
        $('#city').combobox('reload', url);//联动下拉列表重载 
       },
});
$('#prov').combobox("setValue","广东省");
$('#city').combobox({
	valueField:'id',
	textField:'val',
	panelHeight: 300,
	editable:false,
	onSelect:function(record){
		 $('#area').combobox('clear'); //清除原来的数据  
        var url = global.contextPath + '/destin/getArea?city=' + record.id;  
        $('#area').combobox('reload', url);//联动下拉列表重载 
       },
});
$('#area').combobox({
	valueField:'id',
	textField:'val',								
	panelHeight: 300
});

	$(function() {
		$("input[name=areaname]").focus();//主动指定焦点，防止ie的bug			
	});
</script>



